// page/coachs/index/index.js
Page({
  data: {
    isHide: false,
    navIndex: 0,
    current: 1
  },
  onLoad: function (options) {
    var that = this
    that.request();
  },

  // 网络请求
  request: function () {
    var that = this
    wx.request({
      url: getApp().globalData.host + "&m=Coach&a=index", //仅为示例，并非真实的接口地址
      data: {},
      method: 'POST',
      header: {
        'content-type': 'application/json', // 默认值
      },
      success: function (res) {
        console.log(res.data)
        //请求成功
        if (res.data.status == 1) {
          that.setData({
            isHide: true,
            data: res.data
          })
        } else {//请求失败
          wx.showToast({
            title: res.data.info,
          })
        }
      },
      fail: function (res) {
        wx.showToast({
          title: "请求失败",
        })
      }
    })
  },

  bindSwiper: function (e) {
    var that = this
    that.setData({
      current: e.detail.current + 1
    })
  },
  clickKeCheng: function () {
    getApp().getUserOpenId(
      function (uid) {
        wx.navigateTo({
          url: '/page/course/index',
        })
      },
      function (info) {

      },
    );
  },
  clickQianDao: function () {
    getApp().getUserOpenId(
      function (uid) {
        wx.navigateTo({
          url: '/page/student/sign',
        })
      },
      function (info) {

      },
    );
  }
})